﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Light: Light.cs Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                C# examples using state machines generated by StateBuilderDotNet
            </h1>
            <h3>
                Light: Light.cs Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">Light.cs</div>  </div>
</div>
<div class="contents">
<a href="_light_8cs.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a><a class="code" href="namespace_state_forge_1_1_examples_1_1_light.html">00001</a> ﻿namespace StateForge.Examples.Light
<a name="l00002"></a>00002 {
<a name="l00003"></a>00003     <span class="keyword">using</span> System;
<a name="l00004"></a>00004     <span class="keyword">using</span> StateForge.StateMachine;
<a name="l00005"></a>00005 
<a name="l00006"></a><a class="code" href="interface_state_forge_1_1_examples_1_1_light_1_1_i_light_actuator.html">00006</a>     <span class="keyword">public</span> interface <a class="code" href="interface_state_forge_1_1_examples_1_1_light_1_1_i_light_actuator.html">ILightActuator</a>
<a name="l00007"></a>00007     {
<a name="l00008"></a>00008         <span class="keywordtype">void</span> DoOn();
<a name="l00009"></a>00009         <span class="keywordtype">void</span> DoOff();
<a name="l00010"></a>00010     }
<a name="l00011"></a>00011 
<a name="l00012"></a><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light_actuator.html">00012</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light_actuator.html">LightActuator</a> : <a class="code" href="interface_state_forge_1_1_examples_1_1_light_1_1_i_light_actuator.html">ILightActuator</a>
<a name="l00013"></a>00013     {
<a name="l00014"></a><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light_actuator.html#abea6bf791eb4351b65b545fb4f475fde">00014</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> DoOn()
<a name="l00015"></a>00015         {
<a name="l00016"></a>00016             Console.WriteLine(<span class="stringliteral">&quot;DoOn&quot;</span>);
<a name="l00017"></a>00017         }
<a name="l00018"></a>00018 
<a name="l00019"></a><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light_actuator.html#af01950280746609d3273ea5722b32f9b">00019</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> DoOff()
<a name="l00020"></a>00020         {
<a name="l00021"></a>00021             Console.WriteLine(<span class="stringliteral">&quot;DoOff&quot;</span>);
<a name="l00022"></a>00022         }
<a name="l00023"></a>00023     }
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html">00025</a>     <span class="keyword">public</span> <span class="keyword">partial class </span><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html">Light</a> {
<a name="l00026"></a><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html#a67cec9b4c6a9f4bc131ed8d5b0a27c67">00026</a>         <span class="keyword">private</span> <a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light_actuator.html">LightActuator</a> <a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html#a67cec9b4c6a9f4bc131ed8d5b0a27c67">lightActuator</a>;
<a name="l00027"></a><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html#ab3058e1e858694d873eab4ebe128feb1">00027</a>         <span class="keyword">private</span> LightContext <a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html#ab3058e1e858694d873eab4ebe128feb1">context</a>;
<a name="l00028"></a>00028 
<a name="l00029"></a><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html#a86c8b305ab581d2c03bc04c6f21a871d">00029</a>         <span class="keyword">public</span> <a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html">Light</a>()
<a name="l00030"></a>00030         {
<a name="l00031"></a>00031             this.lightActuator = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light_actuator.html">LightActuator</a>();
<a name="l00032"></a>00032             this.context = <span class="keyword">new</span> LightContext(lightActuator);
<a name="l00033"></a>00033             this.context.Observer = ObserverConsole.Instance;
<a name="l00034"></a>00034             this.context.EnterInitialState();
<a name="l00035"></a>00035         }
<a name="l00036"></a>00036         
<a name="l00037"></a><a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html#a64b69abde845f02a5ac5d06b861f9dc5">00037</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> Main(<span class="keywordtype">string</span>[] args)
<a name="l00038"></a>00038         {
<a name="l00039"></a>00039             <a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html">Light</a> light = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_light_1_1_light.html">Light</a>();
<a name="l00040"></a>00040             light.EvOn();
<a name="l00041"></a>00041             <span class="comment">//light.On();</span>
<a name="l00042"></a>00042             <span class="comment">//light.On();</span>
<a name="l00043"></a>00043             <span class="comment">//light.Off();</span>
<a name="l00044"></a>00044             Environment.Exit(0);
<a name="l00045"></a>00045         }
<a name="l00046"></a>00046     }
<a name="l00047"></a>00047 }
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
